package com.teach.mapper;

import java.util.Collection;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.teach.dto.PhotoTriggerUserDTO;
import com.teach.entity.PhotoGreat;

public interface PhotoGreatMapper {
    int deleteByPrimaryKey(Long photoGreatId);

    int insert(PhotoGreat record);

    int insertSelective(PhotoGreat record);

    PhotoGreat selectByPrimaryKey(Long photoGreatId);

    int updateByPrimaryKeySelective(PhotoGreat record);

    int updateByPrimaryKey(PhotoGreat record);
    
    /**
     *	 查询点赞人的 用户名 头像 点赞时间
     * @param pictureIds 相片集id
     * @param username 被点赞人用户名
     * @param status 状态
     * @return
     */
    List<PhotoTriggerUserDTO> selectGreatInform(
    		@Param(value = "pictureIds")Collection<Long> pictureIds, 
    		@Param(value = "username") String username, 
    		@Param(value = "status") String status);


    /*
     *  查询点赞编号
     */
    @Select("select * from photo_great where photo_pic_id=#{picId} and photo_great_user_id=#{picuserId}")
    PhotoGreat selectGreatId(
    		@Param("picId")Long picId,
    		@Param("picuserId")String picUser);
    
    @Update("UPDATE photo_great SET photo_status = #{status},photo_great_time = now() WHERE photo_pic_id = #{picId} AND photo_great_user_id = #{userId}")
    int updateStatus(
    		@Param("status")String status,
    		@Param("picId")Long picId,
    		@Param("userId")String userId);
}